package com.woate.wingframework.utils;

/**
 * 序列号生成样式
 */
public enum SequenceStyle {
    /**
     * 15位序号样式序列号<br>
     *    <ol>
     *        <li>毫秒微保持在9位</li>
     *        <li>服务器号保持在2位</li>
     *        <li>线程号保持在3位</li>
     *        <li>2位随机数字</li>
     *    </ol>
     */
    SEQ_STYLE_15(9, 2, 3,2),
    /**
     * 18位序号样式序列号<br>
     *    <ol>
     *        <li>毫秒微保持在11位</li>
     *        <li>服务器号保持在2位</li>
     *        <li>线程号保持在3位</li>
     *        <li>2位随机数字</li>
     *    </ol>
     */
    SEQ_STYLE_18(11, 2, 3, 2),
    /**
     * 20位序号样式序列号<br>
     *    <ol>
     *        <li>毫秒微保持在11位</li>
     *        <li>服务器号保持在2位</li>
     *        <li>线程号保持在3位</li>
     *        <li>4位随机数字</li>
     *    </ol>
     */
    SEQ_STYLE_20(11, 2, 3, 4);
    int timeMillis;
    int serverId;
    int threadId;
    int random;

    SequenceStyle(int timeMillis, int serverId, int threadId, int random) {
        this.timeMillis = timeMillis;
        this.serverId = serverId;
        this.threadId = threadId;
        this.random = random;
    }

    public int getTimeMillis() {
        return timeMillis;
    }

    public int getServerId() {
        return serverId;
    }

    public int getThreadId() {
        return threadId;
    }

    public int getRandom() {
        return random;
    }
}
